#ifndef _TOOL_REQUESTDISPATCHER_H_
#define _TOOL_REQUESTDISPATCHER_H_

#include "irequestdispatcher.h"

#include <map>
#include <list>

namespace tool {

class RequestDispatcher : public IRequestDispatcher {
	public:
		typedef std::list<IRequestClient*> REQUEST_CLIENT_LIST;
		typedef std::map<uint32_t, REQUEST_CLIENT_LIST> REQUEST_CLIENT_MAP; /* Key = uri */

	private:
		REQUEST_CLIENT_LIST null_client_list;
		REQUEST_CLIENT_MAP request_client_map;

	private:
		REQUEST_CLIENT_LIST& GetRequestClient(uint32_t uri);

	public:
		RequestDispatcher();
		~RequestDispatcher();

	private: /* IRequestDispatcher */
		virtual void OnRequest(pack::Request& request);
		virtual void AddRequestClient(IRequestClient* client);
		virtual void RemoveRequestClient(IRequestClient* client);
};

}

#endif
